home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1998 February / CD WARE MULTIMEDIA (02-1998) CD++.iso / Encript / JSTEG / JSTEG.TXT < prev   
Encoding:
Text File  |  1997-12-18  |  5.7 KB  |  113 lines

  1. This version of the Independent JPEG Group's JPEG Software (release 4)
  2. has been modifed for 1-bit steganography in JFIF output files.
  3.  
  4.  
  5. To compile the package, simply follows the steps given in the original
  6. README file.
  7.  
  8. To inject a data file into a JPEG/JFIF image, simply add the option
  9. "-steg filename" to the "cjpeg" command line.  If the data file is too
  10. large for the image, "cjpeg" will inform you.  At this point, you can
  11. compress the data file, increase the quality of the image (thereby
  12. increasing image size), or try a different image.
  13.  
  14. Extraction of a data file works similarly.  The "-steg filename"
  15. option to "djpeg" writes the steganographic data to the file, wiping
  16. out its previous contents.  Usually, the decoded image sent to
  17. standard output is redirected to "/dev/null".
  18.  
  19.  
  20. Steganography is the science of hiding data in otherwise plain text or
  21. images.  Here, we are hiding the data inside images stored in the JFIF
  22. format of the JPEG standard.  It was believed that this type of
  23. steganography was impossible, or at least infeasible, since the JPEG
  24. standard uses lossy encoding to compress its data.  Any hidden data
  25. would be overwhelmed by the noise.  The trick used by this
  26. steganographic implementation is to recognize that JPEG encoding is
  27. split into lossy and non-lossy stages.  The lossy stages use a
  28. discrete cosine transform and a quantization step to compress the
  29. image data; the non-lossy stage then uses Huffmann coding to further
  30. compress the image data.  As such, we can insert the steganographic
  31. data into the image data between those two steps and not risk
  32. corruption.
  33.  
  34. This method has several benefits.  First, the JPEG/JFIF image format
  35. has become the de-facto standard for transmission across USENET and
  36. for storage on FTP sites.  Steganography using these formats would be
  37. innocuous compared to that with most other formats.  Second,
  38. steganographic data in JPEG images is harder to detect with the naked
  39. eye than the same data in raw 8-bit or 24-bit images.  Just as the
  40. aforementioned lossy raw->encoded conversion tends to wipe out
  41. steganographic data, the reversed, encoded->raw conversion tends to do
  42. the same thing.  The steganographic inaccuracies in the image are
  43. wiped over.  In addition, the wide control available over image
  44. quantization makes it very difficult to establish whether or not the
  45. inaccuracies which do appear are caused by steganographic data or by
  46. lower-quality quantization.
  47.  
  48. The JPEG encoding procedure divides an image into 8x8 blocks of pixels
  49. in the YCbCr colorspace.  Then they are run through a discrete cosine
  50. transform (DCT) and the resulting frequency coefficients are scaled to
  51. remove the ones which a human viewer would not detect under normal
  52. conditions.  If steganographic data is being loaded into the JPEG
  53. image, the loading occurs after this step.  The lowest-order bits of
  54. all non-zero frequency coefficients are replaced with successive bits
  55. from the steganographic source file, and these modified coefficients
  56. are sent to the Huffmann coder.  (This choice of encoding slots produces
  57. good results, but there may be better ones.  For example, tests have
  58. shown that the human eye is less sensitive to changes along the Cb and
  59. Cr colorspace axes---we ought to be able to stick more data there.)
  60.  
  61. The steganographic encoding format (the format of data inserted into
  62. the lowest-order bits of the image) is as follows:
  63.  
  64.   +-----+-----------     -----+--------------------------------
  65.   |  A  |  B  B  B  . . .  B  |  C  C  C  C  C  C  C  C  C  C  . . .
  66.   +-----+-----------     -----+--------------------------------
  67.  
  68.   "A" is five bits.  It expresses the length (in bits) of field B.
  69.   Order is most-significant-bit first.
  70.  
  71.   "B" is some number of bits from zero to thirty-one.  It expresses
  72.   the length (in bytes) of the injection file.  Order is again
  73.   most-significant-bit first.  The range of values for "B" is 0 to
  74.   one billion.
  75.  
  76.   "C" is the bits in the injection file.  No ordering is implicit on
  77.   the bit stream.
  78.  
  79. This format is designed to make the steganographic data as innocuous
  80. as possible.  (As one would expect, there is no magic cookie at the
  81. front giving the format).  We are forced to have a length field at the
  82. beginning of the data, since any sort of in-band EOF tag would be
  83. infeasible.
  84.  
  85. Expressing the length field as a raw series of bits representing an
  86. integer would be dangerous, however; for any sort of small
  87. steganographic file, there would be a long string of zeroes in the
  88. field---very easy to detect.  By stripping off the zeroes and creating
  89. a secondary length field for our primary length field(!), we greatly
  90. reduce the problem.  The five bits for the secondary length field is
  91. small enough that runs of zeroes are not a problem, and it allows a
  92. primary length field of up to thirty-one bits.
  93.  
  94. There is still a danger in that the sixth bit of the stream will
  95. always be one; this is solved by tacking an extra zero onto the
  96. beginning of the primary length field in half the cases.  This helps
  97. randomize the output, although it reduces the representable data size
  98. to one gigabyte.
  99.  
  100. The storage effectiveness for this steganographic technique is
  101. reasonable, but not astounding.  Using the simple encoding criteria
  102. described above, an N kilobyte data file fits when the resulting
  103. JPEG/JFIF file is around C*N kilobytes, where C ranges from eight to
  104. ten.  This is not much worse than raw 24-bit insertion, and the
  105. possibility of tweaking with regards to colorspace could produce even
  106. better results.  Compressing the steganographic file before injection
  107. does not seem to greatly harm compression in the envelope image; the
  108. data spreading that occurs during injection increases entropy enough
  109. for Huffmann coding to work.
  110.  
  111. Derek Upham
  112. upham@cs.ubc.ca
  113.